import { registerAs } from '@nestjs/config';

import { IsString } from 'class-validator';
import validateConfig from '@/utils/validate-config';
import { AgentConfig } from './agent-config.type';

class EnvironmentVariablesValidator {
  @IsString()
  LLM_MODEL_NAME?: string;

  @IsString()
  LLM_MODEL_API_URL?: string;

  @IsString()
  LLM_MODEL_API_KEY?: string;
}

export default registerAs<AgentConfig>('agent', () => {
  validateConfig(process.env, EnvironmentVariablesValidator);
  return {
    llmModelName: process.env.LLM_MODEL_NAME || 'deepseek-v3-0324',
    llmModelApiUrl:
      process.env.LLM_MODEL_API_URL || 'https://api.tokenpony.cn/v1',
    llmModelApiKey:
      process.env.LLM_MODEL_API_KEY || 'sk-e6129d79a4644ce8be1088919b87d542',
  };
});
